_TITLE "Shell of another color (animated)"
' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.09.17.17.11]) on 2023.09.20 at 16:37 (Coordinated Universal Time)
' Program by b+, ported to BAM (and animation mod) by Charlie Veniot
' _TITLE "Shell of another color 3" 'b+2020-01-25
'inspired by "shell-like thing" by tsh73 Jan 2020 at JB
' 2020-01-27 Shell of another color 3 adds more improvements
SCREEN _NEWIMAGE(660, 660, 32)
DIM x(1600), y(1600), c AS LONG
cx = 340: cy = 390
FOR a = 0 TO _PI(8) STEP _PI(2 / 400) ' load x, y arrays
x(i) = cx + ra * COS(a): y(i) = cy + ra * SIN(a)
dr = dr + 1 / 1700: ra = ra + dr ^ 2: i = i + 1
NEXT
WHILE 1
R = RND ^ 2: G = RND ^ 2: B = RND ^ 2: PN = 0: size = 1
FOR i = 0 TO 1139
dx = x(i + 400) - x(i): dy = y(i + 400) - y(i)
dist = SQR(dx * dx + dy * dy): dx = dx / dist: dy = dy / dist: PN = PN + .73
IF i > 820 THEN
size = 3
ELSEIF i > 380 THEN
size = 2
END IF
FOR j = 0 TO dist
shade = 1 - ((dist / 2 - j + 1 / 2) / (dist / 2)) ^ 2
c = _RGB32(shade * INT(127 + 127 * SIN(R * PN)), shade * INT(127 + 127 * SIN(G * PN)), shade * INT(127 + 127 * SIN(B * PN)))
CIRCLE (x(i) + j * dx, y(i) + j * dy ) , size, cF
' CIRCLE (x(i) + j * dx + 1, y(i) + j * dy ) , size, c
NEXT
if j mod 4 = 0 then _delay 0.001
NEXT
_DELAY 2
WEND